<?php
/**
 * A hack fix for templating
 * May change. VOLITILE
 * 
 **/

function tplHead() { 
?>
<html>
 <head>
 </head>
 <body>
<?php
}

function tplFoot() {
?>
 </body>
</html>
<?php
}

function tplPost( $post ) {
  echo <<<EOE
<h1>{$post['name']}</h1><br />
<p>{$post['datum']}</p>
EOE;
}
function tplPostEditButton( $post ) {
  echo <<<EOE
<a href="post.php?tnum=${post['tid']}&pnum=${post['rank']}" >EDIT</a>
EOE;
}
function tplPostReplyButton( $post ) {
  echo <<<EOE
<a href="post.php?tnum=${post['tid']}" >Reply</a>
EOE;
}

function tplThread( $thread ) {
  echo "<p><a href=\"spit.php?type=POST&tnum=${thread['id']}&start=1&end=5\">${thread['name']} - ${thread['datum']}</a></p>";
}
function tplForum( $forum ) {
  echo "<p><a href=\"spit.php?type=THREAD&fnum=${forum['id']}&start=1&end=5\">${forum['name']} - ${forum['datum']}</a></p>";
}

function tplEditPost( $post ) {
echo <<<EOE
<form action="./gulp.php" method="post" >
  <input type="hidden" name="type" value="POST" />
  <input type="hidden" name="pnum" value="${post['rank']}" />
  <input type="hidden" name="tnum" value="${post['tid']}" />
  
  title:
  <input type="text" name="title" value="${post['name']}" /><br />
  text:
  <textarea name="datum" rows="10" cols="30">${post['datum']}</textarea><br />
  <input type="submit" value="DOOM">
</form>

EOE;
}
function tplNewPost( $tnum, $fnum ) {
echo <<<EOE
<form action="./gulp.php" method="post" >
  <input type="hidden" name="type" value="POST" />
  <input type="hidden" name="tnum" value="$tnum" />
  <input type="hidden" name="fnum" value="$fnum" />
  
  title:
  <input type="text" name="title" value="" /><br />
  text:
  <textarea name="datum" rows="10" cols="30">
    Insert Text Har. Mmkays
  </textarea><br />
  <input type="submit" value="DOOM">
</form>

EOE;
}
function tplNewThread( $fnum ) {
echo <<<EOE
<form action="./gulp.php" method="post" >
  <input type="hidden" name="type" value="POST" />
  <input type="hidden" name="fnum" value="$fnum" />
  
  title:
  <input type="text" name="title" value="" /><br />
  text:
  <textarea name="datum" rows="10" cols="30">
    Insert Text Har. Mmkays
  </textarea><br />
  <input type="submit" value="DOOM">
</form>

EOE;
}

function tplNewThreadButton( $fnum ) {
  echo <<<EOE
<a href="post.php?fnum=${fnum}" >New Thread</a>
EOE;
}

function tplEditForum( $forum ) {
  echo <<<EOO
        <form>
          <input type="hidden" name="type" value="FORUM" />
          <input type="hidden" name="fnum" value="${forum['id']}" />
          <input type="text" name="title" value="" />
          <input type="text" name="datum" value="" />
          <submit type="submit" value="submit">
        </form>
EOO;
}
function tplNewForum( ) {
  echo <<<EOO
         <form>
          <input type="hidden" name="type" value="FORUM" />
          <input type="hidden" name="fnum" value="-1" />
          <input type="text" name="title" value="" />
          <input type="text" name="datum" value="" />
          <submit type="submit" value="submit">
        </form>
EOO;

}

?>
